package avicit.bdp.dcs.common.rest;

import avicit.bdp.dcs.common.dto.EnumDto;
import avicit.bdp.dcs.common.service.CommonService;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-07-21 11:55
 * @类说明：通用接口
 * @修改记录：
 */
@RestController
@RequestMapping("/api/bdp/dcs/common/CommonRest")
@Api(tags = "通用接口")
public class CommonRest {

    @Autowired
    private CommonService commonService;

    @GetMapping("/getJobStatus")
    @ApiOperation(value = "获取job状态码")
    public ResponseMsg<List<EnumDto>> getJobStatus(@ApiParam(value = "类型，数据迁移：1，数据同步：2", name = "jobType", required = true) @RequestParam Integer jobType) throws Exception{
        ResponseMsg<List<EnumDto>> responseMsg = new ResponseMsg<>();
        responseMsg.setResponseBody(commonService.getJobStatus(jobType));
        return responseMsg;
    }

    @GetMapping("/getIotDataType")
    @ApiOperation(value = "获取iotdb数据类型")
    public ResponseMsg<List<EnumDto>> getIotDataType() throws Exception{
        ResponseMsg<List<EnumDto>> responseMsg = new ResponseMsg<>();
        responseMsg.setResponseBody(commonService.getIotDataType());
        return responseMsg;
    }

}
